package com.sc.controller.csm;

import com.sc.dto.PatrolDailyDTO;
import com.sc.dto.PatrolMonthlyDTO;
import com.sc.dto.PatrolWeeklyDTO;
import com.sc.result.PageResult;
import com.sc.result.Result;
import com.sc.service.csm.PatrolReportService;
import com.sc.vo.PatrolDailyVO;
import com.sc.vo.PatrolMonthlyVO;
import com.sc.vo.PatrolWeeklyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/patrolReport")
@Api(tags = "巡更巡检报告接口")
@RequiredArgsConstructor
public class PatrolReportController {

    private final PatrolReportService patrolReportService;

    @ApiOperation("巡更日报分页查询")
    @PostMapping("/daily")
    public Result<PageResult<PatrolDailyVO>> daily(@RequestBody PatrolDailyDTO patrolDailyDTO) {
        return Result.success(patrolReportService.daily(patrolDailyDTO));
    }

    @ApiOperation("巡更周报分页查询")
    @PostMapping("/weekly")
    public Result<PageResult<PatrolWeeklyVO>> weekly(@RequestBody PatrolWeeklyDTO patrolWeeklyDTO) {
        return Result.success(patrolReportService.weekly(patrolWeeklyDTO));
    }

    @ApiOperation("巡更月报分页查询")
    @PostMapping("/monthly")
    public Result<PageResult<PatrolMonthlyVO>> monthly(@RequestBody PatrolMonthlyDTO patrolMonthlyDTO) {
        return Result.success(patrolReportService.monthly(patrolMonthlyDTO));
    }
}
